/**
 * 	 Copyright (c) 2008, 2009 Lukas Zaruba
 * 
 *   This file is part of UniAnalyzer (Universal Analyzer).
 *
 *   UniAnalyzer is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU Lesser General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   UniAnalyzer is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU Lesser General Public License for more details.
 *
 *   You should have received a copy of the GNU Lesser General Public License
 *   along with UniAnalyzer. If not, see <http://www.gnu.org/licenses/>.
 */

package net.zarubsys.unianalyzer.dataminers.lpt.pin;

import static net.zarubsys.unianalyzer.dataminers.lpt.pin.PinHelper.reservedLabel;

/**
 * Pin
 *
 * @author  &lt;A HREF=&quot;mailto:lukas.zaruba@media-solutions.cz&quot;&gt;Lukas Zaruba&lt;/A&gt;, MEDIA SOLUTIONS CZECH REPUBLIC Ltd.
 * @version $Revision$ $Date$
 */
public enum Pin implements IPin {
	
	DATA0(0, 0, 2, "Data 0", false), //$NON-NLS-1$
	DATA1(0, 1, 3, "Data 1", false), //$NON-NLS-1$
	DATA2(0, 2, 4, "Data 2", false), //$NON-NLS-1$
	DATA3(0, 3, 5, "Data 3", false), //$NON-NLS-1$
	DATA4(0, 4, 6, "Data 4", false), //$NON-NLS-1$
	DATA5(0, 5, 7, "Data 5", false), //$NON-NLS-1$
	DATA6(0, 6, 8, "Data 6", false), //$NON-NLS-1$
	DATA7(0, 7, 9, "Data 7", false), //$NON-NLS-1$
	
	STATUS0(1, 0, -1, reservedLabel, true),
	STATUS1(1, 1, -1, reservedLabel, true),
	STATUS2(1, 2, -1, reservedLabel, true),
	ERROR(1, 3, 15, "Error", false), //$NON-NLS-1$
	SELECT_IN(1, 4, 13, "Select In", false), //$NON-NLS-1$
	PAPER_OUT(1, 5, 12, "Paper Out", false), //$NON-NLS-1$
	ACK(1, 6, 11, "Ack", false), //$NON-NLS-1$
	BUSY(1, 7, 10, "Busy", false), //$NON-NLS-1$
	
	STROBE(2, 0, 1, "Strobe", false), //$NON-NLS-1$
	AUTO_LINEFEED(2, 1, 14, "ALFeed", false), //$NON-NLS-1$
	INITIALIZE(2, 2, 16, "Initialize", false), //$NON-NLS-1$
	C_SELECT_IN(2, 3, 17, "Select In", false), //$NON-NLS-1$
	CONTROL4(2, 4, -1, reservedLabel, true),
	CONTROL5(2, 5, -1, reservedLabel, true),
	CONTROL6(2, 6, -1, reservedLabel, true),
	CONTROL7(2, 7, -1, reservedLabel, true);
	
	
	private final int offset;
	private final int orderInByte;
	private final int number;
	private final String description;
	private final boolean reserved;
	
	private Pin(int offset, int orderInByte, int number, String description, boolean reserved) {
		this.offset = offset;
		this.orderInByte = orderInByte;
		this.number = number;
		this.description = description;
		this.reserved = reserved;
	}

	public int getOffset() {
		return offset;
	}

	public int getOrderInByte() {
		return orderInByte;
	}

	public int getNumber() {
		return number;
	}

	public String getDescription() {
		return description;
	}
	
	public boolean isReserved() {
		return reserved;
	}
	
	public String getLabel() {
		StringBuilder sb = new StringBuilder();
		sb.append(orderInByte).append(": ").append(number != -1 ? number : "x").append(" - ").append(description); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
		return sb.toString();
	}
	
}


/*
 * $Log$
 */